package com.cn.wanxi.model;

public class ResultModel {
    private String msg;
    private Integer code;
    private Object data;
    private Integer count;

    private ResultModel(String msg, Integer code, Object data, Integer count) {
        this.msg = msg;
        this.code = code;
        this.data = data;
        this.count = count;
    }

    /**
     * 通过影响的条数得到service的结果对象
     *
     * @param count
     * @return
     */
    public static ResultModel getModel(Integer count) {
        return new ResultModel("", 0, null, count);
    }

    public static ResultModel getModel(Object list, Integer count) {
        return new ResultModel("", 0, list, count);
    }

    public static ResultModel getModel(String msg) {
        return new ResultModel(msg, 0, null, 0);
    }

    public static ResultModel getModel(Object data) {
        return new ResultModel("", 0, data, 0);
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
